<template>
	<view class="page" >
		<userOrder ref="useOrder" v-if="tabberType==1"></userOrder>
		<riderOrder ref="rierOrder" v-if="tabberType==2"></riderOrder>
		<tabBer v-if="tabberType==2" :typeOr="2"></tabBer>
	</view>
</template>
<script>
    import riderOrder from "../components/riderOrder/riderOrder.vue"
    import userOrder from "../components/userOrder/userOrder.vue"
	import tabBer from "../components/tabBar/tabBar.vue";
    export default {
        components: {riderOrder,userOrder,tabBer},
        
        
        data(){
			return {
				tabberType:1,
			};
		},
		computed:{
            
		},
		watch:{},
		onLoad(options){
            
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
			uni.showShareMenu({
				withShareTicket: true,
				//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
				menus: ["shareAppMessage"]
			})
            if(uni.getStorageSync('tabberType')){
            	this.tabberType = uni.getStorageSync('tabberType')
            	if(this.tabberType == 1){
					uni.showTabBar({
					  animation: true, // 是否需要动画效果
					  success: function () {
					    console.log('TabBar has been shown successfully.');
					    // 在这里编写显示后的逻辑
					  },
					  fail: function (err) {
					    console.error('Failed to show TabBar:', err);
					  }
					});
					uni.setTabBarItem({
					    index: 0, // tabIndex，下标从0开始
					    text: '首页', // 新的文字内容
					    success: function () {
					        console.log('Tab bar item text updated successfully!');
					    },
					    fail: function (err) {
					        console.error('Failed to update tab bar item text:', err);
					    }
					});
            		this.$nextTick(() => {
            			this.$refs.useOrder.together();
            		})
            	}else{
					uni.hideTabBar()
					// 假设我们要修改第二个tab的文字
					uni.setTabBarItem({
						index: 0, // tabIndex，下标从0开始
						text: '抢单大厅', // 新的文字内容
						success: function () {
							console.log('Tab bar item text updated successfully!');
						},
						fail: function (err) {
							console.error('Failed to update tab bar item text:', err);
						}
					});
            		this.$nextTick(() => {
            			this.$refs.rierOrder.together();
            		})
            	}
            }else{
				this.$nextTick(() => {
					this.$refs.useOrder.together();
				})
			}
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh() {
			if(this.tabberType == 1){
				this.$nextTick(() => {
					this.$refs.useOrder.isShow = true
					this.$refs.useOrder.upType = true
					this.$refs.useOrder.page = 1
					this.$refs.useOrder.together();
				})
			}else{
				this.$nextTick(() => {
					this.$refs.rierOrder.isShow = true
					this.$refs.rierOrder.upType = true
					this.$refs.rierOrder.page = 1
					this.$refs.rierOrder.together();
				})
			}
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom(e) {
			// console.log(this.$refs.useOrder.upType,'执行了')
			let _this = this
			if(this.tabberType == 1){
				this.$nextTick(() => {
					if(this.$refs.useOrder.upType){
						_this.$refs.useOrder.page++
						_this.$refs.useOrder.getsa670e3e65dc60Func()
					}
				})
			}else{
				
				this.$nextTick(() => {
					if(this.$refs.rierOrder.upType){
						_this.$refs.rierOrder.page++
						_this.$refs.rierOrder.getoa66ff2284d28dFunc()
					}
				})
			}
		},
		onPageScroll(e){
            
		},
		methods:{
            
		}
    };
</script> 
<style lang="scss" scoped>
   
</style>